<div class="dynconMenu" id="dynconMenu">
    <div class="right-card-header">
        <div class="title">{lang dynamic}</div>
    </div>
    <div class="right-card-body">
        <ul class="lyear-timeline lyear-timeline-left just-now" id="just-now"></ul>
        <!--{template template_dynamic_list}-->
    </div>
</div>

<script type="text/javascript" reload="1">
    //滚动条滚动，头部加阴影
    $('.right-messagetable').scroll(function () {
        if ($(this).scrollTop() > 0) {
            $('.briefMenu').css({'box-shadow': '0px 0px 10px 0px rgba(0,0,0,0.15)'});
        } else {
            $('.briefMenu').css({'box-shadow': 'none'});
        }
    })

    jQuery(document).ready(function (e) {
        smilies_show('leave_message_sml_div', '{$_G[setting][smcols]}', 'leave_message');
        _explorer.Scroll();
        jQuery('#leave_message').off("input.commet propertychange.comment").on("input.comment propertychange.comment", function (e) {
            var el = jQuery(this);
            var msg = el.val();
            var disbutton = el.closest('.comment-area').find('button');
            if (msg.length <= 0) {
                disbutton.addClass("disabled");
                disbutton.css({'color': 'rgba(55,121,255,0.3)'});
            } else {
                disbutton.removeClass("disabled");
                disbutton.css({'color': 'rgba(55,121,255,1)'});
            }
        });
        jQuery('#leave_message').focus(function () {
            var el = jQuery(this);
            var msg = el.val();
            var disbutton = el.closest('.comment-area').find('button');
            if (msg.length <= 0) {
                disbutton.addClass("disabled");
                disbutton.css({'color': 'rgba(55,121,255,0.3)'});
            } else {
                disbutton.removeClass("disabled");
                disbutton.css({'color': 'rgba(55,121,255,1)'});
            }
        })

    });

    function comment_file(form) {
        if ($('#leave_message').val().length < 1) {
            $('#leave_message').focus();
            return false;
        }
        $.post(form.action, jQuery(form).serialize(), function (data) {
            if (data['success']) {
                var html = '';
                html += '<li class="lyear-timeline-item dynameic-commen">';
                html += '<div class="lyear-timeline-item-dot">';
                html += '<span><a href="user.php?uid=' + data['return']['uid'] + '" title="' + data['return']['username'] + '"  target="_blank">' + data['return']['avatar'] + '</a></span>';
                html += '</div>';
                html += '<div class="lyear-timeline-item-content">';
                html += '<p class="mb-1 text-break" title="' + data['return']['username'] + '">';
                html += '<strong>' + data['return']['username'] + '</strong>';
                html += '</p>';
                html += '<p class="mb-0 text-break">发表了评论：' + data['return']['msg'];
                html += '<span class="delete-comment color-danger mdi mdi-delete" data-commentid="' + data['return']['commentid'] + '"></span>'
                html += '</p>';
                html += '<p><time class="mb-3">'+data['return']['dateline']+ '</time></p>';
                html += '</div> ';
                html += '</li>';
                $('#just-now').prepend(html);
                $('.scroll-y').animate({scrollTop: '0px'}, 200);
                showmessage('评论成功','success',3000,1);
            } else if(data['error']) {
                showmessage(data['error'],'error',3000,1);
            } else {
                showmessage('评论失败','error',3000,1);
            }
            $('#leave_message').val('').trigger('input');
        }, 'json').fail(function (jqXHR, textStatus, errorThrown) {
            showmessage('操作失败，请稍后再试: ' + textStatus, 'error', 3000, 1);
        });
        return false;
    }

</script>